import { GameContext } from "@sapi-game/gameContext";
import { PlayerGroup, PlayerGroupSet } from "@sapi-game/gamePlayer";
import { BlockedInCombatConfig, BlockedTeamData } from "./interface";
import { BlockedInCombatMap, BlockedInCombatMaps } from "./map";
import { BlockedInCombatPlayer } from "./player";

export class BlockedInCombatContext extends GameContext {
    readonly teams: PlayerGroup<BlockedInCombatPlayer, BlockedTeamData>[];
    readonly groupSet: PlayerGroupSet<BlockedInCombatPlayer, BlockedTeamData>;
    readonly map: BlockedInCombatMap;
    readonly config: BlockedInCombatConfig;

    winner?: PlayerGroup<BlockedInCombatPlayer, BlockedTeamData>;

    constructor(
        teams: PlayerGroup<BlockedInCombatPlayer, BlockedTeamData>[],
        config: BlockedInCombatConfig
    ) {
        super();
        this.teams = teams;
        this.config = config;
        this.map =
            BlockedInCombatMaps[config.mapIndex] ?? BlockedInCombatMaps[0];
        this.groupSet = new PlayerGroupSet(teams);
    }
}
